<template>
  <div class="common-body-wrapper">
    <search-header
      single-width="130"
      :searchList="searchList"
      @changeHeight="toRetTable"
      @confirmSearch="toSearch"
      :isNeedTree="true"
      :isCheckbox="true"
      :paramName="paramName"
      @setSelectedNode="setSelectedNode"
    ></search-header>
    <div class="common-table-tree-wrapper">
      <div class="common-table-wrapper">
        <multi-fun-table
          :sortColumn="notFormatColumn"
          :orderType="sortType"
          :fixed-cols="fixedCols"
          :is-reset-table="isResetTable"
          :theads-info="theadsInfo"
          :tbodys-info="tbodysInfo"
          @handleMultiCheck="handleMultiCheck"
          @handleSortColumn="handleSortColumn"
          @searchFn="getList"
          @getNextPage="getNextPage"
        >
          <div class="operate-btn-group" slot="operateBtnGroup">
            <a
              class="ake_btn ake_btn_text"
              v-if="isPermmited('PARK_EMERGENCY:LOG:CHANNEL:EXPORT')"
              @click.prevent="exportData()"
            >导出</a>
          </div>
          <template slot="tdCell" slot-scope="props">
            <el-table-column
              :fixed="props.fixed"
              :label="props.label"
              :min-width="props.minWidth"
              :width="props.width"
              :prop="props.prop"
              :sortable="props.sortable"
            >
              <template slot-scope="scope">
                <span v-if="'reno' == props.prop">{{scope.$index+1}}</span>
                <!-- <span v-else-if="'linkPriority' == props.prop">{{ scope.row[props.prop] }}</span> -->
                <span v-else>{{ scope.row[props.prop] }}</span>
              </template>
            </el-table-column>
          </template>
        </multi-fun-table>

        <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
      </div>
    </div>

    <!--选择停车场树-->
    <basic-modal ref="selectParkModal" width="400" customeClass="select-park-modal" static="true">
      <h3 slot="title">选择停车场</h3>
      <div class="modal-body" slot="modal-body">
        <div class="common-tree modal-tree-box">
          <ul id="ParkTree" name="ParkTree" class="ztree"></ul>
        </div>
      </div>
      <div class="modal-footer" slot="modal-footer">
        <button
          type="button"
          class="ake_btn ake_btn_text ake_btn_confirm"
          @click="selectParkSure()"
        >确认</button>
        <button class="ake_btn ake_btn_text modal-close" @click="closed('selectParkModal',2)">取消</button>
      </div>
    </basic-modal>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";

// 引进vue的js
import offline_emergency_record from "./js/offline_emergency_record.js";

export default {
  mixins: [common, stardardList, invokeModal, offline_emergency_record],
  data() {
    const today = [
      new Date(moment().format("YYYY-MM-DD 00:00:00")),
      new Date(moment().format("YYYY-MM-DD 23:59:59"))
    ];
    return {
      total: 0,
      fixedCols: 0,
      paramName: "query_warningOrigin",
      searchList: [
        {
          index: 0,
          isShow: false,
          type: "datePicker",
          name: "query_time",
          text: "离线时间",
          propName: "query_since,query_end",
          value: today,
          style: { width: "360px" }
        },
        {
          index: 1,
          isShow: false,
          type: "select",
          name: "query_ytjLinkPriority",
          text: "通讯网络",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "双网", value: "-1" },
            { name: "有线", value: "0" },
            { name: "4G", value: "1" }
          ]
        },
        {
          index: 2,
          isShow: false,
          type: "select",
          name: "query_handleStatus",
          text: "重连状态",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "未重连", value: "0" },
            { name: "已重连", value: "1" }
          ]
        }
      ],
      theadsInfo: [
        {
          index: 1,
          isShow: false,
          prop: "warningOrigin",
          text: "数据来源（车场+通道）",
          minWidth: 220
        },
        {
          index: 2,
          isShow: false,
          prop: "linkPriority",
          text: "通讯网络",
          minWidth: 155
        },
        {
          index: 3, //4
          isShow: false,
          prop: "createTime",
          text: "离线时间",
          minWidth: 155
        },
        {
          index: 4, //3
          isShow: false,
          prop: "offlineTime",
          text: "离线时长(分钟)",
          minWidth: 155
        },
        {
          index: 5, //6
          isShow: false,
          prop: "handleStatus",
          text: "重连状态",
          minWidth: 155
        },
        {
          index: 6, //5
          isShow: false,
          prop: "reconnectTime",
          text: "重连时间",
          minWidth: 155
        }
      ],
      tbodysInfo: []
    };
  }
};
</script>